<template>
  <div>
    <TypeNav/>
    <List/>
    <Recommend/>
    <Rank/>
    <Like/>
    <!-- 根据楼层数据遍历floor -->
    <Floor v-for='floor in floorList' :key='floor.id' :floor='floor'/>
    <Brand/>
    <router-view></router-view>
  </div>
</template>

<script>
import List from './components/List';
import Recommend from './components/Recommend';
import Rank from './components/Rank';
import Like from './components/Like';
import Floor from './components/Floor';
import Brand from './components/Brand';
import { reqFloorList } from "@/api";
export default {
    name:'Home',
    components:{
      List,
      Recommend,
      Rank,
      Like,
      Floor,
      Brand
    },
    data(){
      return {
        floorList:[]
      }
    },
    mounted() {
      //初始化请求floor的数据
      this.getFloorList()
    },
    methods: {
      //1. 封装初始化请求floor的数据
      // 异步任务，可以先在methods中写好方法，然后，在mounted中调用方法；
      async getFloorList(){
        const re = await reqFloorList();
        this.floorList = re;
      }
    },
}
</script>

<style>

</style>